package com.legsem.jhosync.voltdb.server;

import org.voltdb.ProcInfo;
import org.voltdb.SQLStmt;
import org.voltdb.VoltProcedure;
import org.voltdb.VoltTable;

@ProcInfo(partitionInfo = "USERS.LOGIN: 0", singlePartition = true)
public class UpdateUser extends VoltProcedure {

    public final SQLStmt sql = new SQLStmt(
            "UPDATE USERS SET EMAIL = ?, SALT = ?, HASHED_PASSWORD = ?, ADMIN = ?, TOKEN = ? WHERE LOGIN=?;");

    public VoltTable[] run(String login, String email, String salt,
            String hashedPassword, int admin, String token)
            throws VoltAbortException {

        voltQueueSQL(sql, email, salt, hashedPassword, admin, token, login);
        return voltExecuteSQL();
    }
}
